/**
 * filename: UserInfoHibernateDao.java
 * author: luruifeng
 * date: 2016年3月1日
 * http: <a href='http://www.anzeinfo.com'>www.anzeinfo.com</a>
 * Copyright (c) 2016 Anze, Inc. All rights reserved.
 */
package com.anze.abd.persistence.dao.impl.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.anze.abd.persistence.dao.UserInfoDao;
import com.anze.abd.persistence.domain.UserInfo;
import com.anze.base.persistence.dao.commons.hibernate.BaseHibernateDao;
import com.anze.base.persistence.domain.User;

/**
 * 用户信息
 * @author luruifeng 2016年3月1日
 * @version 2.4
 * @since 2.4 2016年3月1日
 */
@Repository("userInfoDao")
public class UserInfoHibernateDao extends BaseHibernateDao<UserInfo> implements UserInfoDao {

	/* (non-Javadoc)
	 * @see com.anze.abt.persistence.dao.UserInfoDao#getByUser(com.anze.base.persistence.domain.User)
	 */
	@Override
	public UserInfo getByUser(User user) {
		String hql = "from UserInfo ui where ui.user.id = ?";
		List<UserInfo> infos = findByParam(hql, user.getId());
		if (null != infos && !infos.isEmpty()) {
			return infos.get(0);
		}
		return null;
	}

}
